package com.kingyea.esb.commons.datawrap;

import java.util.HashMap;
import java.util.Map;

//已完成
public class CommonDataWrap implements DataWrap {
	private static final long serialVersionUID = 1L;

	protected String message;
	protected Integer code;
	protected boolean success;
	private Map<String, Object> attributes;
	
	public CommonDataWrap() {
	}

	public CommonDataWrap(boolean success, String message) {
		this.success = success;
		this.message = message;
	}
	
	public void addAttribute(String key, Object value) {
		if(null==attributes) {
			this.attributes = new HashMap<String, Object>();
		}
		this.attributes.put(key, value);
	}
	
	public Object removeAttribute(String key) {
		if(null==attributes) {
			return null;
		}
		return attributes.remove(key);
	}

	public String getMessage() {
		return message;
	}

	public void setMessage(String message) {
		this.message = message;
	}

	public Integer getCode() {
		return code;
	}

	public void setCode(Integer code) {
		this.code = code;
	}

	public boolean isSuccess() {
		return success;
	}

	public void setSuccess(boolean success) {
		this.success = success;
	}

	public Map<String, Object> getAttributes() {
		return attributes;
	}

	public void setAttributes(Map<String, Object> attributes) {
		this.attributes = attributes;
	}
	
	
}
